Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meson: uses system directories in machine files #227

Merged
merged 1 commit into from
Mar 24, 2024

Conversation

kleisauke
Copy link
Collaborator

Noticed this while doing:

$ mkdir linux-x64
$ curl -fsSL https://github.com/lovell/sharp-libvips/releases/download/v8.15.2/libvips-8.15.2-linux-x64.tar.gz | tar xzC linux-x64
$ strings linux-x64/lib/libvips-cpp.so.42 | grep "/fontconfig"
  <dir prefix="xdg">fonts</dir>  <cachedir>/target/var/cache/fontconfig</cachedir>  <cachedir prefix="xdg">fontconfig</cachedir>  <include ignore_missing="yes">/etc/fonts/conf.d</include>  <include ignore_missing="yes" prefix="xdg">fontconfig/conf.d</include>  <include ignore_missing="yes" prefix="xdg">fontconfig/fonts.conf</include></fontconfig>
/target/share/fontconfig/conf.avail
/target/var/cache/fontconfig
/fontconfig

With this PR, I see:

$ strings libvips-8.15.2-linux-x64/lib/libvips-cpp.so.42 | grep "/fontconfig"
  <dir prefix="xdg">fonts</dir>  <cachedir>/var/cache/fontconfig</cachedir>  <cachedir prefix="xdg">fontconfig</cachedir>  <include ignore_missing="yes">/etc/fonts/conf.d</include>  <include ignore_missing="yes" prefix="xdg">fontconfig/conf.d</include>  <include ignore_missing="yes" prefix="xdg">fontconfig/fonts.conf</include></fontconfig>
/usr/share/fontconfig/conf.avail
/var/cache/fontconfig
/fontconfig

And this during configuring Fontconfig:

   Paths
-    Cache directory            : /target/var/cache/fontconfig
-    Template directory         : /target/share/fontconfig/conf.avail
+    Cache directory            : /var/cache/fontconfig
+    Template directory         : /usr/share/fontconfig/conf.avail
     Base config directory      : /etc/fonts
     Config directory           : /etc/fonts/conf.d
-    XML directory              : /target/share/xml/fontconfig
+    XML directory              : /usr/share/xml/fontconfig

@kleisauke
Copy link
Collaborator Author

kleisauke commented Mar 24, 2024

FWIW, grep-ing for /target would still result in:

$ strings libvips-8.15.2-linux-x64/lib/libvips-cpp.so.42 | grep "/target"
/target/share/color/icc
/target
/target/lib
/target/share/locale
/target/var/lib/dbus/machine-id
/target/var
/dev/shm/journal9999-12-31T23:59/target/lib/gio/k

The first three paths are from libvips and correspond to VIPS_ICC_DIR, VIPS_PREFIX and VIPS_LIBDIR.
https://github.com/libvips/libvips/blob/c1565644277792804b73d11242bed3e1414f86ff/meson.build#L682
https://github.com/libvips/libvips/blob/c1565644277792804b73d11242bed3e1414f86ff/libvips/iofuncs/util.c#L1976
https://github.com/libvips/libvips/blob/c1565644277792804b73d11242bed3e1414f86ff/meson.build#L655-L656
https://github.com/libvips/libvips/blob/c1565644277792804b73d11242bed3e1414f86ff/libvips/iofuncs/init.c#L552-L553

The next three paths are from GLib and correspond to GLIB_LOCALE_DIR, GLIB_LOCALSTATEDIR.
https://github.com/GNOME/glib/blob/e124c34ad6d04c725a0e6f46c2b8934838af04ef/meson.build#L2285-L2288
https://github.com/GNOME/glib/blob/e124c34ad6d04c725a0e6f46c2b8934838af04ef/glib/ggettext.c#L72
https://github.com/GNOME/glib/blob/e124c34ad6d04c725a0e6f46c2b8934838af04ef/gio/gdbusprivate.c#L2452
https://github.com/GNOME/glib/blob/e124c34ad6d04c725a0e6f46c2b8934838af04ef/gio/gunixmounts.c#L271

I'm not sure about the last one, but it probably corresponds to GIO_MODULE_DIR.
https://github.com/GNOME/glib/blob/e124c34ad6d04c725a0e6f46c2b8934838af04ef/gio/giomodule.c#L1261

@lovell
Copy link
Owner

lovell commented Mar 24, 2024

Excellent detective work Kleis. Given we're always overriding --prefix for meson-based dependencies, perhaps we should be setting these options for all meson-compiled dependencies e.g. via meson.ini?

@kleisauke kleisauke changed the title fontconfig: ensure configuration uses system directories Meson: uses system directories in machine files Mar 24, 2024
@kleisauke
Copy link
Collaborator Author

Good idea! Just updated this PR to set these options in the Meson machine files instead. I now see:

$ strings libvips-8.15.2-linux-x64/lib/libvips-cpp.so.42 | grep "/target"
/target
/target/lib
/dev/shm/journal9999-12-31T23:59/target/lib/gio/k

@lovell lovell merged commit 6e83482 into lovell:main Mar 24, 2024
14 checks passed
@lovell
Copy link
Owner

lovell commented Mar 24, 2024

Brilliant, thanks for spotting/fixing this.

@kleisauke kleisauke deleted the fontconfig-paths branch March 24, 2024 17:03
calebmer added a commit to cyberworlds/sharp-libvips that referenced this pull request Aug 29, 2024
calebmer pushed a commit to cyberworlds/sharp-libvips that referenced this pull request Aug 29, 2024
NOTE(calebmer): Reverting to the initial commit from lovell#227. Making datadir (but not bindir) a system directory causes meson to try and install libraries in system directories where it doesn’t have permission without sudo. This is dangerous when building on a local developer machine.

This change doesn’t seem to be motivated by any specific bug but rather removing the “/target” path from built binaries. Since this change didn’t fix any specific bugs and makes builds on local machines more difficult I’m reverting the change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants